home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Tele / S / SmartClone.3.cpt / SmartClone 0.3.rsrc / STR#_1002.txt < prev    next >
Encoding:
Text File  |  1988-08-22  |  4.5 KB  |  263 lines

  1. SERVICE:               COMMAND KEY: ?
  2.  
  3. IF (@modemFile = "") OR (NOT Exists%(ServiceFPath & @modemFile)) THEN ‚àÇ
  4.  
  5.     GOSUB getModemFile
  6.  
  7.  
  8.  
  9. MiniTermPhoneNumber = @MiniTermPhoneNumber
  10.  
  11. SET DBOX 400
  12.  
  13. DBoxResp(1) = MiniTermPhoneNumber
  14.  
  15. CheckBox%(1) = @redial%
  16.  
  17. DBOX 400
  18.  
  19. dialLoop:
  20.  
  21.     dbr% = DBoxResult%
  22.  
  23.     IF dbr% = -2 THEN ‚àÇ
  24.  
  25.         GOTO dialLoop
  26.  
  27. HOLD ON
  28.  
  29. CURSOR WATCH
  30.  
  31. redial% = CheckBox%(1)
  32.  
  33. dbr = DBoxResp(1)
  34.  
  35. IF dbr% = Cancel% THEN ‚àÇ
  36.  
  37.     END
  38.  
  39. CLEAR DBOX 400
  40.  
  41. @redial% = redial%
  42.  
  43. IF dbr = "" THEN CLEAR @MiniTermPhoneNumber:END
  44.  
  45. IF MiniTermPhoneNumber <> dbr THEN ‚àÇ
  46.  
  47.     @MiniTermPhoneNumber = dbr
  48.  
  49. IF dbr% = OK% THEN END
  50.  
  51. Message = dbr
  52.  
  53. SaveMessage = Message
  54.  
  55. HOLD OFF
  56.  
  57. redial:
  58.  
  59.     DO FILE @modemFile "Dial"
  60.  
  61.     IF ResultCode% <> 0 THEN ‚àÇ
  62.  
  63.         badFile = @modemFile: ‚àÇ
  64.  
  65.         badLabel = "Dial": ‚àÇ
  66.  
  67.         GOSUB doFileError: ‚àÇ
  68.  
  69.         END
  70.  
  71.     IF Message <> "" THEN ‚àÇ
  72.  
  73.         IF @redial% THEN ‚àÇ
  74.  
  75.             Message = SaveMessage: ‚àÇ
  76.  
  77.             GOTO redial ‚àÇ
  78.  
  79.         ELSE DISPLAY "Unable to connect:  " & Message
  80.  
  81.     END
  82.  
  83.  
  84.  
  85. getModemFile: 'gets name of modem file and stores it in variable @modemFile
  86.  
  87.     HOLD ON
  88.  
  89.     Message = ""
  90.  
  91.     prompt1 = "Please select the modem file:"
  92.  
  93.     fileType1 = "SERV"
  94.  
  95.     HOLD OFF
  96.  
  97.     modemFile = GetFile(prompt1,fileType1,ServiceFPath)
  98.  
  99.     IF (ResultCode% = 100) OR (DBoxResult% = CANCEL%) THEN END
  100.  
  101.     HOLD ON
  102.  
  103.     CURSOR WATCH
  104.  
  105.  
  106.  
  107.     'parse the path from string returned by GetFile
  108.  
  109.     myPath = modemFile
  110.  
  111.     lastColon% = 0
  112.  
  113. getLastColon:
  114.  
  115.     IF InStr%(lastColon%+1, myPath, ":") <> 0 THEN ‚àÇ
  116.  
  117.         lastColon% = lastColon%+1: GOTO getLastColon
  118.  
  119.  
  120.  
  121.     myPath = Left(myPath,lastColon%)
  122.  
  123.     modemFile = Mid(modemFile, lastColon%+1)
  124.  
  125.  
  126.  
  127.     ServiceFPath = myPath   ' set ServiceFPath to path returned by GetFile
  128.  
  129.     Message = ""
  130.  
  131.     HOLD OFF
  132.  
  133.     DO FILE modemFile "Identify"
  134.  
  135.     IF (ResultCode% <> 0) THEN ‚àÇ
  136.  
  137.         IF (ResultCode% <> 106) THEN ‚àÇ          ' bad label error
  138.  
  139.             badFile = modemFile: ‚àÇ              ' 106 is "label not found" error
  140.  
  141.             badLabel = "Identify": ‚àÇ
  142.  
  143.             GOSUB doFileError: ‚àÇ
  144.  
  145.             CURSOR RESET: ‚àÇ
  146.  
  147.             END ‚àÇ
  148.  
  149.         ELSE Message = "NotModem"               ' coerce dbox for error #106
  150.  
  151.  
  152.  
  153.     ' check for if modemFile is really a modem file
  154.  
  155.     IF UpCase(Message) <> "MODEM" THEN ‚àÇ
  156.  
  157.         DBoxSay = modemFile & " does not appear to be a modem file.  " & ‚àÇ
  158.  
  159.             "An example of a modem file for Apple and " & ‚àÇ
  160.  
  161.             "Hayes-compatible modems is ""Hayes Modem.""  Try again?": ‚àÇ
  162.  
  163.         DBOX 2: ‚àÇ
  164.  
  165.         IF DBoxResult% = OK% THEN GOTO getModemFile ‚àÇ
  166.  
  167.         ELSE CURSOR RESET: END
  168.  
  169.     HOLD ON
  170.  
  171.  
  172.  
  173.     ' check to see if modem file in Lookup Table is still there
  174.  
  175.     IF @ModemFile <> "" THEN ‚àÇ
  176.  
  177.         IF NOT Exists%(ServiceFPath & @modemFile) THEN CLEAR @modemFile ‚àÇ
  178.  
  179.         ELSE DO FILE @modemFile "ClearTable": ‚àÇ
  180.  
  181.             IF ResultCode% <> 0 THEN ‚àÇ  ' check for errors executing "DO FILE"
  182.  
  183.                 badFile = @modemFile: ‚àÇ
  184.  
  185.                 badLabel =  "ClearTable": ‚àÇ
  186.  
  187.                 GOSUB doFileError: ‚àÇ
  188.  
  189.                 END
  190.  
  191.  
  192.  
  193.     @modemFile = modemFile  ' put new modem file in lookup table
  194.  
  195.     HOLD OFF
  196.  
  197.     CURSOR RESET
  198.  
  199.     Message = ""            ' routine was successful
  200.  
  201.     RETURN
  202.  
  203.  
  204.  
  205. doFIleError:    ' puts up error dialog and aborts
  206.  
  207.  
  208.  
  209.     HOLD OFF
  210.  
  211.     BELL:BELL   ' alert user
  212.  
  213.     ' Give user a description of error
  214.  
  215.     IF ResultCode% = 100 THEN END ‚àÇ
  216.  
  217.     ELSE IF ResultCode% = 106 THEN DBoxSay = "Cannot find the label """ & badLabel & ‚àÇ
  218.  
  219.         """ in the file """ & badFile & """.  Program aborted." ‚àÇ
  220.  
  221.     ELSE IF ResultCode% = -108 THEN ‚àÇ
  222.  
  223.         DBoxSay = "Not enough memory to open the file """ & ‚àÇ
  224.  
  225.         badFile & """.  Program aborted." ‚àÇ
  226.  
  227.     ELSE IF ResultCode% = -35 THEN ‚àÇ
  228.  
  229.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  230.  
  231.         """ because volume specified doesn't exist.  Program aborted." ‚àÇ
  232.  
  233.     ELSE IF ResultCode% = -49 THEN ‚àÇ
  234.  
  235.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  236.  
  237.         """ because it is already open for writing.  Program aborted." ‚àÇ
  238.  
  239.     ELSE IF ResultCode% = -47 THEN ‚àÇ
  240.  
  241.         DBoxSay = "Cannot open the file """ & badFile & ‚àÇ
  242.  
  243.         """ because it is busy.  Program aborted." ‚àÇ
  244.  
  245.     ELSE DBoxSay = "The following error occurred during a call to """ & badLabel & ‚àÇ
  246.  
  247.         """ in the file """ & badFile & """:  Macintosh error result code = " & ‚àÇ
  248.  
  249.         ResultCode% & ".  Program aborted."
  250.  
  251.     DBOX 1
  252.  
  253.     RETURN
  254.  
  255.  
  256.  
  257. Interrupt:
  258.  
  259.     DBOX 0
  260.  
  261.     LEAVE
  262.  
  263.